﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>提单统计-微街秀管理后台</title>
    <link href="../css/admin.css" rel="stylesheet" type="text/css" />
    <link href="../css/css.css" rel="stylesheet" type="text/css" />
    <link href="../../client/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <style>
        body{ background-color:White; font-size:14px;}
        table{border-collapse: collapse;border: none;width:100%; text-align:center;}
        td{border: solid #ccc 1px;color:Black; height:26px;}
        td a{ text-decoration:none;}
        .td1,.td2,.td3,.td6{width:100px; height:30px; font-weight:bold; text-align:center;}
        .td4,.td5{width:250px; font-weight:bold; text-align:center;}
        .td4{width:80px;}
        .sp{display:block; text-align:right;}
        .th_sort_click{ background-color:#ccc;}
    </style>
    <script src="../js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="../js/base.js" type="text/javascript"></script>
    <script src="../js/ajax-data.js" type="text/javascript"></script>
    <script src="../js/Pager.js" type="text/javascript"></script>
    <script src="../js/dialog.js" type="text/javascript"></script>
    <script src="../js/DatePicker/zh-cn/WdatePicker.js" type="text/javascript"></script>
    <script src="../js/jquery.sortElements.js" type="text/javascript"></script>
</head>
<body>
<div style="width:70%; min-width:880px; margin-left:auto; margin-right:auto;">
<div> 会员编号:<input type="text" id="userid" name="userid" style="width:80px;" />
    公司名:<input type="text" id="sitename" name="sitename" style="width:120px;"/>
    时间段:<input type="text" id="starttime" name="starttime" style="width:80px;"  onclick="WdatePicker()"/>至
    <input type="text" id="endtime" name="endtime" style="width:80px;"  onclick="WdatePicker()"/>
    <input type="button" id="btn" value="搜 索" onclick="submits()" /> 说明：推荐使用谷歌浏览器打开
</div>

  <span class="sp">代理商数:<span class="count">0</span></span>
  <table id="mytable" class="table-striped table-hover table-bordered">
    <tr>
        <th id="column1" class='td1'>微街秀ID<span class="glyphicon glyphicon-resize-vertical"></th>
        <th id="column2" class='td5'>公司名</th>
        <th id="column3" class='td2'>余额<span class="glyphicon glyphicon-resize-vertical"></span></th>
        <th id="column4" class='td3'>销售量<span class="glyphicon glyphicon-resize-vertical"></span></th>
        <th id="column5" class='td3'>代理版本</th>
        <th id="column6" class='td4'>开通日期</th>
        <th id="column7" class='td4'>到期</th>
        <th id="column8" class='td3'>操作</th>
    </tr>
    <tbody id="list">
    </tbody>
    </table>
    <span class="sp">代理商数:<span class="count">0</span></span>
<br />
<br />
<input type="hidden" id="pagecount" value="0" />
</div>
 <script>
     $(function () {
         var sitename = getUrlArgStr("sitename");
         $("#sitename").html(decodeURIComponent(sitename));
         GetList(1);
         sort();
     })

     function GetList(page) {
         var userid = $("#userid").val();
         var sitename = $("#sitename").val();
         var yewu_id = $("#yewu_id").val();
         
         var param = "page=" + page + "&userid=" + userid + "&sitename=" + decodeURIComponent(sitename);
         var ok_salesman = "100";
         //签名认证参数
         param += "&ok_salesman=" + ok_salesman + "&sales=" + GetQuery("sales") + "&uname=" + GetQuery("uname") + "&salesman=" + GetQuery("salesman") + "&time=" + GetQuery("time") + "&sign=" + GetQuery("sign");

         param += "&starttime=" + $("#starttime").val() + "&endtime=" + $("#endtime").val();
         $("#list").html("");
         var html = "";

         AjaxStart("../ajax/agent.ashx?getlist_tidan", param, function (data) {
             if (data.code != 0) {
                 $("#list").html(html + "<tr><td colspan='8'>" + data.msg + "</td></tr>");
             }
             else {
                 $("#list").html("");
                 var list = data.item.table;
                 for (var i = 0; i < list.length; i++) {
                     html += "<tr>";
                     html += "<td>" + list[i].UserId_wjx + "</td>";
                     html += "<td style='text-align:left;'>" + list[i].sitename + "</td>";
                     html += "<td>" + list[i].Balance + "元</td>";
                     html += "<td>" + list[i].counts + "</td>";
                     html += "<td>微街秀</td>";
                     html += "<td>" + GetDate(list[i].JoinTime) + "</td>";
                     html += "<td>" + GetDate(list[i].end_time) + "</td>";
                     html += "<td><a href='list_user.html?version_id=3,66&sitename=" + list[i].sitename + "&agentid=" + list[i].UserId_wjx + "'  target=\"_blank\">查看客户</a></td>";
                     html += "</tr>";
                 }
                 $("#list").html(html);
                 $(".count").html(list.length)                               
             }
         });
     }

     function sort() {
         var table = $('#mytable');
         $('#column1,#column3,#column4').each(function () {
             var th = $(this),
                thIndex = th.index(),
                inverse = false;

             th.click(function () {
                 table.find('td').filter(function () {
                     return $(this).index() === thIndex;
                 }).sortElements(function (a, b) {
                     var is_a = isNaN($.text([a]));
                     var is_b = isNaN($.text([b]));

                     return parseFloat($.text([a])) > parseFloat($.text([b])) ?
                        inverse ? -1 : 1
                        : inverse ? 1 : -1;

                     if (!is_a && !is_b) {
                        return parseFloat($.text([a])) > parseFloat($.text([b])) ?
                        inverse ? -1 : 1
                        : inverse ? 1 : -1;
                     }
                     else {
                        return $.text([a]) > $.text([b]) ?
                        inverse ? -1 : 1
                        : inverse ? 1 : -1;
                     }
                 }, function () {
                     // parentNode is the element we want to move
                     return this.parentNode;
                 });
                 inverse = !inverse;
                 // change the color of the head
                 $('#column1,#column3,#column4,#column6,#column7').removeClass("th_sort_click")
                 $(this).addClass("th_sort_click")
             });
         });
     }
     function GetQuery(name) {
         if (getQueryString(name) == null) return "";
         return getQueryString(name);
     }
     function submits() {
         GetList(1);
     }
 </script>
</body>
</html>
